package com.xin.web;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.xin.entity.SDeptProfessional;
import com.xin.service.SDeptProfessionalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 * 学院专业 前端控制器
 * </p>
 *
 * @author l1
 * @since 2017-10-20
 */
@Controller
public class SDeptProfessionalController {

    @Autowired
    private SDeptProfessionalService sDeptProfessionalService;


    /**
     * 获取学院
     */
    @GetMapping("/dept")
    public List<SDeptProfessional> dept(){
        return sDeptProfessionalService.selectList(new EntityWrapper<SDeptProfessional>()
                .eq("flag","1")
                .orderBy("show_order", true));
    }

    /**
     * 获取学院专业
     */
    @GetMapping("/professional/{id}")
    public List<SDeptProfessional> professional(@PathVariable("id") String id){
       return sDeptProfessionalService.selectList(new EntityWrapper<SDeptProfessional>()
                .eq("parent_id", id)
                .orderBy("show_order", true));

    }
}
